const fs = require('fs')
const path = require('path')
const express = require('express')
const puppeteer = require('puppeteer');
const {
	Worker,
	isMainThread,
	MessagePort
} = require("worker_threads")

const app = express()

const port = 4080
const countJs = require("./public/common/count")

var files = []
var count = countJs()
var nowWorkerNum = 0
var maxWorkerNum = 2

app.use(express.static('public'))

var router = express.Router()
const findFile = i => {
	let worker = new Worker('./public/workerJs/one.js')
	worker.postMessage([i])
}

const getFileList = () => {

	if (isMainThread) {
		console.log("主线程")
	}
	let i = 0
	while (i < 1) {
		findFile(i)
		i++
	}
}
getFileList()


app.use('/mock', router)

app.listen(port, function() {
	console.log(port + '开启成功')
})
